import React from "react";
import { Navigate, type RouteObject } from "react-router-dom";
import { AuthRouter } from "./AuthRouter";

const Login = React.lazy(() => import("../views/login"));
const Admin = React.lazy(() => import("../views/admin"));

const routes: RouteObject[] = [
  {
    path: "/*",
    element: (
      <AuthRouter>
        <Navigate to="/admin" />
      </AuthRouter>
    ),
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/admin",
    element: (
      <AuthRouter>
        <Admin />
      </AuthRouter>
    ),
  },
];

export default routes;
